package com.admin.service;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.stereotype.Service;

import com.admin.bean.AdminSpCpBean;
import com.admin.bean.AdminSpCpSearchBean;
import com.admin.bean.AdminUserBean;
import com.admin.dao.AdminSpCpDao;

@Service("adminSpCpService")
public class AdminSpCpService {

	@Autowired private AdminSpCpDao adminSpCpDao;
	
	public int adAdminSpCpBean(AdminSpCpBean bean) {
		return adminSpCpDao.adAdminSpCpBean(bean);
	}
	
	public AdminSpCpBean findAdminSpCpBean(int id) {
		return this.adminSpCpDao.findAdminSpCpBean(id);
	}
	
	public int delSpCp(int id){
		return adminSpCpDao.delSpCp(id);
	}
	
	public int delSpCpBySpId(int spid){
		return adminSpCpDao.delSpCpBySpId(spid);
	}
	public int updateKouLiang(int kouliang,int id){
		return adminSpCpDao.updateKouLiang(kouliang,id);
	}
	
	public List<AdminSpCpSearchBean> findListBySpCp(int start,int limit,String condition) {
		try {
			return adminSpCpDao.findListBySpCp(start,limit,condition);
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
			return new ArrayList<AdminSpCpSearchBean>();
		} finally {

		}
	}
	
	public int findCountBySpCp(String condition){
		try {
			return adminSpCpDao.findCountBySpCp(condition);
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
			return 0;
		} finally {

		}
	}
	
	public List<AdminSpCpBean> findListBySpId(int spid) {
		try {
			return adminSpCpDao.findListBySpId(spid);
		} catch (Exception e) {
			e.printStackTrace();
			// TODO: handle exception
			return new ArrayList<AdminSpCpBean>();
		} finally {

		}
	}
	
	public List<AdminSpCpBean> findListByCpId(int cpid){
		try {
			return adminSpCpDao.findListByCpId(cpid);
		} catch (Exception e) {
			e.printStackTrace();
			// TODO: handle exception
			return new ArrayList<AdminSpCpBean>();
		} finally {

		}
	}
	
	
	public List<AdminSpCpBean> findAll(){
		try {
			return adminSpCpDao.findAll();
		} catch (Exception e) {
			e.printStackTrace();
			// TODO: handle exception
			return new ArrayList<AdminSpCpBean>();
		} finally {

		}
	}
}
